package com.xnew.ssoApi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xnew.bean.common.SysUserInfo;
import com.xnew.ssoApi.entity.Menu;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
    @Update("update el_sys_user_info " +
        "set open_id = #{openId} " +
        "WHERE login_name = #{userInfoNo} ")
    void updateByOpenId(@Param("userInfoNo") String userInfoNo,@Param("openId")  String openId);

    @Delete("update el_sys_user_info " +
            "set user_state = #{status} " +
            "WHERE user_info_no = #{userInfoNo} ")
    void updataUserByStatus(@Param("userInfoNo") String userInfoNo,@Param("status") String status);

    @Delete("update el_sys_user_info " +
            "set user_state = #{status} " +
            "WHERE org_user_no = #{orgId} ")
    void updataOrgByStatus(@Param("orgId") String orgId,@Param("status") String status);

    void addData(@Param("param") Map<String,Object> param);
    void deleteData(@Param("param") Map<String,Object> param);
    void selectData(@Param("param") Map<String,Object> param);
    SysUserInfo findUserByOpenId(@Param("openId") String openId);
    SysUserInfo selectByPrimaryKey(@Param("userInfoNo") String userInfoNo);
    SysUserInfo findUserByUserName(@Param("loginName") String loginName);
    List<Map<String, Object>> getRoleByUserId(@Param("userId") String userId);
    List<Map<String, Object>> getResourceByUserId(@Param("userId") String userId);
    List<Menu> selectAll(@Param("loginName") String loginName, @Param("auId") String auId);
}
